export default class EffectAnimCtl extends Laya.Script3D {
    protected _unityParticles:Array<Laya.ShuriKenParticle3D> = [];

    constructor() { super(); }

    public onAwake():void{
        for(var i = 0; i < this.owner.numChildren; ++i){
            let child = this.owner.getChildAt(i);

            for(var j = 0; j < child.numChildren; ++j){
                this._unityParticles.push(child.getChildAt(j) as Laya.ShuriKenParticle3D);
            }
        }   
    }

    public isAlive():boolean{
        this._unityParticles.forEach(element => {
            if(element && element.particleSystem.isAlive){
                return true;
            }
        });

        return false;
    }

    public play():void{
        this._unityParticles.forEach(element => {
            if(element)
                element.particleSystem.play();
        });
    }

}